Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/storage/user_runtime_dir.sh

readonly:user_runtime_dir

Since 0.3.0 · Source

import "{ readonly:user_runtime_dir }" from nice_things/storage/user_runtime_dir.sh

Synopsis
"${user_runtime_dir}"

Configuration

Description
The runtime directory for the current user. Will use the value of the XDG_RUNTIME_DIR environment variable if it is set and the directory exists, or fall back to the directory at /run/user/${UID} if it exists, or fall back to /tmp/user/${UID}, in which case the directory will be created on initialization.

When the XDG_RUNTIME_DIR environment variable is set to an existing directory, there are no external dependencies. In the cases when knowing the User ID is necessary, the initialization of this variable depends on the id external utility.

This variable may be used to read files or named pipes published by other programs in this directory. To create your own runtime files, use the create_runtime_file function instead.

Options

Operands

Stdin

Stdout

Stderr
log_error.

Exit status

  • 0: Successful definition.
  • 13: Failed to create directory (on initialization) (abort).

Abort
Aborts if initialization fails.

Usage examples

# Read a file/named pipe from user runtime directory
do_something <"${user_runtime_dir}/path/to/file"